package org.cfg;

import com.sojoys.artifact.build.data.base.BaseCfg;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.ArrayUtils;
import com.sojoys.artifact.tools.SK_String;
import com.xiaoleilu.hutool.util.StrUtil;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 充值礼包
 */
public class RechargeGiftBagCfg extends BaseCfg<RechargeGiftBagCfg> {

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "recharge_gift_bag";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.RechargeGiftBagCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 18;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","道具","购买开放时间","购买结束时间","购买限制次数","重置时间类型","重置时间","玩家等级限制","首次购买奖励","前台：界面","前台：名称","前台：icon","前台：tag","前台：tagDes","前台：tagDes2","前台","前台：名称","前台：排序",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","item","startDate","endDate","buyCount","resetType","resetDate","playerLevel","firstBuyItem","type","name","icon","tag","tagDes","tagDes2","des1","des2","order",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","item","startDate","endDate","buyCount","resetType","resetDate","playerLevel","firstBuyItem","type","name","icon","tag","tagDes","tagDes2","des1","des2","order",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,3242771,-2129778896,-1607727319,-1010104791,2023809321,2023309725,539145507,165550569,3575610,3373707,3226745,114586,-881267176,-1549478630,3079775,3079776,106006350,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","Map","int[]","int[]","int","int","int","int[]","Map","int","String","String","boolean","String","String","String","String","int",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,Map.class,int[].class,int[].class,Integer.class,Integer.class,Integer.class,int[].class,Map.class,Integer.class,String.class,String.class,Boolean.class,String.class,String.class,String.class,String.class,Integer.class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 道具
	 */
	private Map item;
	
	/**
	 * 购买开放时间
	 */
	private int[] startDate;
	
	/**
	 * 购买结束时间
	 */
	private int[] endDate;
	
	/**
	 * 购买限制次数
	 */
	private int buyCount;
	
	/**
	 * 重置时间类型
	 */
	private int resetType;
	
	/**
	 * 重置时间
	 */
	private int resetDate;
	
	/**
	 * 玩家等级限制
	 */
	private int[] playerLevel;
	
	/**
	 * 首次购买奖励
	 */
	private Map firstBuyItem;
	
	/**
	 * 前台：界面
	 */
	private int type;
	
	/**
	 * 前台：名称
	 */
	private String name;
	
	/**
	 * 前台：icon
	 */
	private String icon;
	
	/**
	 * 前台：tag
	 */
	private boolean tag;
	
	/**
	 * 前台：tagDes
	 */
	private String tagDes;
	
	/**
	 * 前台：tagDes2
	 */
	private String tagDes2;
	
	/**
	 * 前台
	 */
	private String des1;
	
	/**
	 * 前台：名称
	 */
	private String des2;
	
	/**
	 * 前台：排序
	 */
	private int order;
	
	
	
	public static RechargeGiftBagCfg builder() {
		RechargeGiftBagCfg rechargeGiftBagCfg = new RechargeGiftBagCfg();
		return rechargeGiftBagCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 道具
	 */
	public Map getItem() {
		return item;
	}
	
	/**
	 * 购买开放时间
	 */
	public int[] getStartDate() {
		return startDate;
	}
	
	/**
	 * 购买结束时间
	 */
	public int[] getEndDate() {
		return endDate;
	}
	
	/**
	 * 购买限制次数
	 */
	public int getBuyCount() {
		return buyCount;
	}
	
	/**
	 * 重置时间类型
	 */
	public int getResetType() {
		return resetType;
	}
	
	/**
	 * 重置时间
	 */
	public int getResetDate() {
		return resetDate;
	}
	
	/**
	 * 玩家等级限制
	 */
	public int[] getPlayerLevel() {
		return playerLevel;
	}
	
	/**
	 * 首次购买奖励
	 */
	public Map getFirstBuyItem() {
		return firstBuyItem;
	}
	
	/**
	 * 前台：界面
	 */
	public int getType() {
		return type;
	}
	
	/**
	 * 前台：名称
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * 前台：icon
	 */
	public String getIcon() {
		return icon;
	}
	
	/**
	 * 前台：tag
	 */
	public boolean getTag() {
		return tag;
	}
	
	/**
	 * 前台：tagDes
	 */
	public String getTagDes() {
		return tagDes;
	}
	
	/**
	 * 前台：tagDes2
	 */
	public String getTagDes2() {
		return tagDes2;
	}
	
	/**
	 * 前台
	 */
	public String getDes1() {
		return des1;
	}
	
	/**
	 * 前台：名称
	 */
	public String getDes2() {
		return des2;
	}
	
	/**
	 * 前台：排序
	 */
	public int getOrder() {
		return order;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.item;
        values[2] = this.startDate;
        values[3] = this.endDate;
        values[4] = this.buyCount;
        values[5] = this.resetType;
        values[6] = this.resetDate;
        values[7] = this.playerLevel;
        values[8] = this.firstBuyItem;
        values[9] = this.type;
        values[10] = this.name;
        values[11] = this.icon;
        values[12] = this.tag;
        values[13] = this.tagDes;
        values[14] = this.tagDes2;
        values[15] = this.des1;
        values[16] = this.des2;
        values[17] = this.order;
        return values;
	}
	
	protected RechargeGiftBagCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.item = (Map)vals[1];
		this.startDate = (int[])vals[2];
		this.endDate = (int[])vals[3];
		this.buyCount = (int)vals[4];
		this.resetType = (int)vals[5];
		this.resetDate = (int)vals[6];
		this.playerLevel = (int[])vals[7];
		this.firstBuyItem = (Map)vals[8];
		this.type = (int)vals[9];
		this.name = (String)vals[10];
		this.icon = (String)vals[11];
		this.tag = (boolean)vals[12];
		this.tagDes = (String)vals[13];
		this.tagDes2 = (String)vals[14];
		this.des1 = (String)vals[15];
		this.des2 = (String)vals[16];
		this.order = (int)vals[17];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.item);
        map.put(keys[2], this.startDate);
        map.put(keys[3], this.endDate);
        map.put(keys[4], this.buyCount);
        map.put(keys[5], this.resetType);
        map.put(keys[6], this.resetDate);
        map.put(keys[7], this.playerLevel);
        map.put(keys[8], this.firstBuyItem);
        map.put(keys[9], this.type);
        map.put(keys[10], this.name);
        map.put(keys[11], this.icon);
        map.put(keys[12], this.tag);
        map.put(keys[13], this.tagDes);
        map.put(keys[14], this.tagDes2);
        map.put(keys[15], this.des1);
        map.put(keys[16], this.des2);
        map.put(keys[17], this.order);
        return map;
    }
    
    protected RechargeGiftBagCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.item = (Map)map.get(keys[1]);
   		this.startDate = (int[])map.get(keys[2]);
   		this.endDate = (int[])map.get(keys[3]);
   		this.buyCount = (int)map.get(keys[4]);
   		this.resetType = (int)map.get(keys[5]);
   		this.resetDate = (int)map.get(keys[6]);
   		this.playerLevel = (int[])map.get(keys[7]);
   		this.firstBuyItem = (Map)map.get(keys[8]);
   		this.type = (int)map.get(keys[9]);
   		this.name = (String)map.get(keys[10]);
   		this.icon = (String)map.get(keys[11]);
   		this.tag = (boolean)map.get(keys[12]);
   		this.tagDes = (String)map.get(keys[13]);
   		this.tagDes2 = (String)map.get(keys[14]);
   		this.des1 = (String)map.get(keys[15]);
   		this.des2 = (String)map.get(keys[16]);
   		this.order = (int)map.get(keys[17]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.item);
        obj.put(keys[2], this.startDate);
        obj.put(keys[3], this.endDate);
        obj.put(keys[4], this.buyCount);
        obj.put(keys[5], this.resetType);
        obj.put(keys[6], this.resetDate);
        obj.put(keys[7], this.playerLevel);
        obj.put(keys[8], this.firstBuyItem);
        obj.put(keys[9], this.type);
        obj.put(keys[10], this.name);
        obj.put(keys[11], this.icon);
        obj.put(keys[12], this.tag);
        obj.put(keys[13], this.tagDes);
        obj.put(keys[14], this.tagDes2);
        obj.put(keys[15], this.des1);
        obj.put(keys[16], this.des2);
        obj.put(keys[17], this.order);
        return obj;
    }
    
    protected RechargeGiftBagCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
		this.item = obj.getObject(keys[1],Map.class);
		this.startDate = obj.getObject(keys[2],int[].class);
		this.endDate = obj.getObject(keys[3],int[].class);
	    this.buyCount = obj.getIntValue(keys[4]);
	    this.resetType = obj.getIntValue(keys[5]);
	    this.resetDate = obj.getIntValue(keys[6]);
		this.playerLevel = obj.getObject(keys[7],int[].class);
		this.firstBuyItem = obj.getObject(keys[8],Map.class);
	    this.type = obj.getIntValue(keys[9]);
	    this.name = obj.getString(keys[10]);
	    this.icon = obj.getString(keys[11]);
	    this.tag = obj.getBooleanValue(keys[12]);
	    this.tagDes = obj.getString(keys[13]);
	    this.tagDes2 = obj.getString(keys[14]);
	    this.des1 = obj.getString(keys[15]);
	    this.des2 = obj.getString(keys[16]);
	    this.order = obj.getIntValue(keys[17]);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeObject(this.item);
	    byteBuf.writeObject(this.startDate);
	    byteBuf.writeObject(this.endDate);
	    byteBuf.writeInt(this.buyCount);
	    byteBuf.writeInt(this.resetType);
	    byteBuf.writeInt(this.resetDate);
	    byteBuf.writeObject(this.playerLevel);
	    byteBuf.writeObject(this.firstBuyItem);
	    byteBuf.writeInt(this.type);
	    byteBuf.writeString(this.name);
	    byteBuf.writeString(this.icon);
	    byteBuf.writeBoolean(this.tag);
	    byteBuf.writeString(this.tagDes);
	    byteBuf.writeString(this.tagDes2);
	    byteBuf.writeString(this.des1);
	    byteBuf.writeString(this.des2);
	    byteBuf.writeInt(this.order);
    }
	
	protected RechargeGiftBagCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.item = (Map)byteBuf.readObject();
	    this.startDate = byteBuf.readIntArray(null);
	    this.endDate = byteBuf.readIntArray(null);
	    this.buyCount = byteBuf.readInt(null);
	    this.resetType = byteBuf.readInt(null);
	    this.resetDate = byteBuf.readInt(null);
	    this.playerLevel = byteBuf.readIntArray(null);
	    this.firstBuyItem = (Map)byteBuf.readObject();
	    this.type = byteBuf.readInt(null);
	    this.name = byteBuf.readString(null);
	    this.icon = byteBuf.readString(null);
	    this.tag = byteBuf.readBoolean(null);
	    this.tagDes = byteBuf.readString(null);
	    this.tagDes2 = byteBuf.readString(null);
	    this.des1 = byteBuf.readString(null);
	    this.des2 = byteBuf.readString(null);
	    this.order = byteBuf.readInt(null);
	    return this;
	}
	
	public RechargeGiftBagCfg deepCopy(){
		RechargeGiftBagCfg rechargeGiftBagCfg = null;
		try {
			rechargeGiftBagCfg = (RechargeGiftBagCfg) super.clone();
		    rechargeGiftBagCfg.item = ToolCopy.copyObject(this.item);
		    rechargeGiftBagCfg.startDate = ToolCopy.copyObject(this.startDate);
		    rechargeGiftBagCfg.endDate = ToolCopy.copyObject(this.endDate);
		    rechargeGiftBagCfg.playerLevel = ToolCopy.copyObject(this.playerLevel);
		    rechargeGiftBagCfg.firstBuyItem = ToolCopy.copyObject(this.firstBuyItem);
			return rechargeGiftBagCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return rechargeGiftBagCfg;
	}
//自定义内容起始位置
//自定义内容结束位置
}
